//
//  CustomView.m
//  HappyBug
//
//  Created by liulei on 2018/10/30.
//  Copyright © 2018年 www.hc.com.cn. All rights reserved.
//

#import "CustomView.h"

@interface CustomView(){
    

}

@property (nonatomic,assign) NSInteger age;

@property (nonatomic,assign) NSInteger name;


@end

@implementation CustomView{
    UILabel *label;
    
    CGRect innerframe;
}
-(void)setAge:(NSInteger)age{
    
}

-(void)setName:(NSInteger)name{
    
}
-(NSInteger)age{
    
    return 1;
    
}
-(NSInteger)name{
    
    return 1;

}
/*
 自定义view
 1 初始化 使用initwithframe
 2 初始化方法里面不设置子控件的frame
 3 layoutSubviews 方法里面设置子控件的frame
 */
-(instancetype)initWithFrame:(CGRect)frame{
    self =[super initWithFrame:frame];
    if(self){
        innerframe=frame;
        label =[[UILabel alloc]init];
        label.text=@"";
        label.frame = CGRectMake(0, 0,frame.size.width * 0.5, frame.size.height * 0.5);
        label.backgroundColor=[UIColor redColor];
        [self addSubview:label];
    }
    return self;
    
}
-(void)layoutSubviews{
    [super layoutSubviews];
   // label.frame = CGRectMake(0, 0,innerframe.size.width * 0.5,innerframe.size.height * 0.5);
}

@end
